home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / Mesa / src-glut / glutGet.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-02  |  2.5 KB  |  103 lines

  1. /*
  2.  * Amiga GLUT graphics library toolkit
  3.  * Version:  1.1
  4.  * Copyright (C) 1998 Jarno van der Linden
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Library General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * This library is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  * Library General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Library General Public
  17.  * License along with this library; if not, write to the Free
  18.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  */
  20.  
  21.  
  22. /*
  23.  * glutGet.c
  24.  *
  25.  * Version 1.0  27 Jun 1998
  26.  * by Jarno van der Linden
  27.  * jarno@kcbbs.gen.nz
  28.  *
  29.  */
  30.  
  31.  
  32. #include <proto/intuition.h>
  33.  
  34. #include "glutstuff.h"
  35.  
  36.  
  37. int glutGet( GLenum state)
  38. {
  39.     switch(state)
  40.     {
  41.         case GLUT_WINDOW_X:
  42.             return(glutstuff.curwin->wincurx);
  43.         case GLUT_WINDOW_Y:
  44.             return(glutstuff.curwin->wincury);
  45.         case GLUT_WINDOW_WIDTH:
  46.             return(glutstuff.curwin->wincurwidth);
  47.         case GLUT_WINDOW_HEIGHT:
  48.             return(glutstuff.curwin->wincurheight);
  49.         case GLUT_ELAPSED_TIME:
  50.             {
  51.                 ULONG secs,micros;
  52.  
  53.                 CurrentTime(&secs,µs);
  54.                 if(!glutstuff.havebasetime)
  55.                 {
  56.                     glutstuff.basetime_secs = secs;
  57.                     glutstuff.basetime_micros = micros;
  58.                     glutstuff.havebasetime = TRUE;
  59.                 }
  60.  
  61.                 return(((int)(secs - glutstuff.basetime_secs))*1000 + ((int)(micros - glutstuff.basetime_micros))/1000);
  62.             }
  63.         case GLUT_WINDOW_DOUBLEBUFFER:
  64.             {
  65.                 GLboolean db;
  66.                 glGetBooleanv(GL_DOUBLEBUFFER, &db);
  67.                 return(db ? 1 : 0);
  68.             }
  69.         case GLUT_WINDOW_RGBA:
  70.             {
  71.                 GLboolean rgb;
  72.                 glGetBooleanv(GL_RGBA_MODE,&rgb);
  73.                 return(rgb ? 1 : 0);
  74.             }
  75.         case GLUT_WINDOW_PARENT:
  76.             return(0);
  77.         case GLUT_WINDOW_NUM_CHILDREN:
  78.             return(0);
  79.         case GLUT_WINDOW_STEREO:
  80.             {
  81.                 GLboolean stereo;
  82.                 glGetBooleanv(GL_STEREO,&stereo);
  83.                 return(stereo ? 1 : 0);
  84.             }
  85.         case GLUT_SCREEN_WIDTH:
  86.             return(glutstuff.curwin->window->WScreen->Width);
  87.         case GLUT_SCREEN_HEIGHT:
  88.             return(glutstuff.curwin->window->WScreen->Height);
  89.         case GLUT_MENU_NUM_ITEMS:
  90.             return(glutstuff.curmenu->numentries);
  91.         case GLUT_INIT_WINDOW_X:
  92.             return(glutstuff.initposx);
  93.         case GLUT_INIT_WINDOW_Y:
  94.             return(glutstuff.initposy);
  95.         case GLUT_INIT_WINDOW_WIDTH:
  96.             return(glutstuff.initwidth);
  97.         case GLUT_INIT_WINDOW_HEIGHT:
  98.             return(glutstuff.initheight);
  99.     }
  100.  
  101.     return(-1);
  102. }
  103.